package com.lib.common.dialog_fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;

import com.lib.common.R;

@SuppressLint("ValidFragment")
public class LoginSuccessDialogFragment extends BaseDialogFragment implements View.OnClickListener {
    public LoginSuccessDialogFragment() {

    }

    @Override
    @SuppressLint("InflateParams")
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setCancelable(false);
        mView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_login_success, null);
        mView.findViewById(R.id.enter).setOnClickListener(this);
        mView.findViewById(R.id.toModifyPwd).setOnClickListener(this);
        mView.findViewById(R.id.toModifyPhone).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        FragmentActivity activity = getActivity();
        if (activity == null) {
            return;
        }
        int i = v.getId();
        if (i == R.id.enter) {
            dismissAllowingStateLoss();
        } else if (i == R.id.toModifyPwd) {
            new ModifyPwdDialogFragment().show(activity);
        } else if (i == R.id.toModifyPhone) {
            new ModifyPhoneDialogFragment().show(activity);
        }
    }
}